//
//  ViewController.m
//  YSAlertActionExample
//
//  Created by Kyson on 2018/5/7.
//  Copyright © 2018年 YangShen. All rights reserved.
//

#import "ViewController.h"
#import "YSAlertAction.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)dosomething {
    NSLog(@"嘿嘿嘿");
}

- (IBAction)alertAction:(UIButton *)sender {
    __weak __typeof(self) weakSelf = self;
    if (sender.tag == 1) {
        [YSAlertAction showAlertWithTitle:@"标题" message:@"提示消息内容" buttonTitles:@[@"取消"] buttonIndexBlock:nil];
    }
    else if (sender.tag == 2) {
//        [YSAlertAction showAlertWithTitle:@"标题" message:@"提示消息内容" buttonTitles:@[@"取消", @"确认"] buttonIndexBlock:nil];
        [YSAlertAction showAlertWithTitle:@"标题" message:@"提示消息内容" buttonTitles:@[@"取消", @"确认"] buttonIndexBlock:^(NSInteger buttonIdx) {

        }];
    }
    else {
        [YSAlertAction showAlertWithTitle:@"标题" message:@"提示消息内容" buttonTitles:@[@"取消", @"确认", @"真确认"] buttonIndexBlock:^(NSInteger buttonIdx) {
            NSLog(@"%zd", buttonIdx);
            [weakSelf dosomething];
        }];
    }
}

- (IBAction)sheetAction:(UIButton *)sender {
    __weak __typeof(self) weakSelf = self;
    if (sender.tag == 1) {
        [YSAlertAction showActionSheetWithTitle:@"标题" message:@"ios8系统之后才会显示本消息内容" cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:nil buttonIndexBlock:nil];
    }
    else if (sender.tag == 2) {
//        [YSAlertAction showActionSheetWithTitle:@"标题" message:@"ios8系统之后才会显示本消息内容" cancelButtonTitle:@"取消" destructiveButtonTitle:@"销毁" otherButtonTitles:nil buttonIndexBlock:nil];
        
        [YSAlertAction showActionSheetWithTitle:@"标题" message:@"ios8系统之后才会显示本消息内容" cancelButtonTitle:@"取消" destructiveButtonTitle:@"销毁" otherButtonTitles:nil buttonIndexBlock:^(NSInteger buttonIdx) {
        NSLog(@"%zd", buttonIdx);
        [weakSelf dosomething];
        }];
    }
    else {
        [YSAlertAction showActionSheetWithTitle:@"标题" message:@"ios8系统之后才会显示本消息内容" cancelButtonTitle:@"取消" destructiveButtonTitle:@"销毁" otherButtonTitles:@[@"确认", @"真确认"] buttonIndexBlock:^(NSInteger buttonIdx) {
            NSLog(@"%zd", buttonIdx);
            [weakSelf dosomething];
        }];
    }
}


@end
